﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace 点歌防沉闷
{
    partial class AboutBox1 : Form
    {
        public delegate void SendResult(bool IsRPL,bool CanVote,bool UseOtherKey);
        public event SendResult sres;
        public AboutBox1(bool CanVote,bool UseOtherKey)
        {
            InitializeComponent();
            this.Text = String.Format("关于 {0}", AssemblyTitle);
            this.labelVersion.Text = String.Format("版本 {0}", AssemblyVersion);
            this.checkBox1.Checked = CanVote;
            this.checkBox2.Checked = UseOtherKey;
        }

        #region 程序集特性访问器

        public string AssemblyTitle
        {
            get
            {
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
                    if (titleAttribute.Title != "")
                    {
                        return titleAttribute.Title;
                    }
                }
                return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
            }
        }

        public string AssemblyVersion
        {
            get
            {
                return Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
        #endregion

        private void okButton_Click(object sender, EventArgs e)
        {
            sres(false, this.checkBox1.Checked, this.checkBox2.Checked);
            this.Close();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void AboutBox1_Load(object sender, EventArgs e)
        {

        }
    }
}
